<?php

namespace kdapi;

class Subscribe extends Api
{
    const ReqURL = 'http://api.kdniao.com/api/dist';

    public function __construct($ShipperCode, $LogisticCode)
    {
        $this->ShipperCode = $ShipperCode;
        $this->LogisticCode = $LogisticCode;
    }

    public function orderTracesSubByJson()
    {
        $request = [
            'ShipperCode' => $this->ShipperCode,
            'LogisticCode' => $this->LogisticCode,
        ];
        $requestData = json_encode($request, JSON_UNESCAPED_UNICODE);
        $datas = array(
            'EBusinessID' => self::EBusinessID,
            'RequestType' => '1002',//'1008',
            'RequestData' => urlencode($requestData),
            'DataType' => '2',
        );
        $datas['DataSign'] = $this->encrypt($requestData, self::AppKey);
        $result = $this->sendPost(self::ReqURL, $datas);
        return $result;
    }

}
